package com.zhuojy.equity.mall.admin.web.controller.car;


import com.zhuojy.equity.mall.admin.common.entity.po.car.TCarInsurancePO;
import com.zhuojy.equity.mall.admin.common.pojo.ResultEntity;
import com.zhuojy.equity.mall.admin.service.car.TCarInsuranceService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xrz
 * @version 1.0
 * @description:TODO
 * @date 2024/4/8 19:50
 */
@RestController
@RequiredArgsConstructor
@CrossOrigin
@RequestMapping("carinsurance")
public class TCarInsuranceController {
    @Autowired
    private TCarInsuranceService tCarInsuranceService;

    /**
     * 分页查询保险记录
     * @param tCarMaintainPO
     * @param pageSize
     * @param pageNum
     * @return
     */
    @RequestMapping("findCarcheerPagination")
    private ResultEntity findCarcheerPagination(@RequestBody TCarInsurancePO tCarMaintainPO, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum){
        return tCarInsuranceService.findCarcheerPagination(tCarMaintainPO,pageSize,pageNum);
    }

    /**
     * 通过id删除对应的信息
     * @param id
     * @return
     */
    @RequestMapping("delinsurance")
    private ResultEntity delMaintain(@RequestParam("id")Integer id){
        return tCarInsuranceService.delMaintain(id);
    }

    /**
     * 添加保险记录
     * @param tCarMaintainPO
     * @return
     */
    @RequestMapping("addinsurance")
    private ResultEntity addMaintain(@RequestBody TCarInsurancePO tCarMaintainPO){
        return tCarInsuranceService.addMaintain(tCarMaintainPO);
    }

    /**
     * 通过id回想对应的信息
     * @param id
     * @return
     */
    @RequestMapping("echoinsurance")
    private ResultEntity echoMaintain(@RequestParam("id") Integer id){
        return tCarInsuranceService.echoMaintain(id);
    }

    /**
     * 修改对应的信息
     * @param tCarMaintainPO
     * @return
     */
    @RequestMapping("upinsurance")
    private ResultEntity upMaintain(@RequestBody TCarInsurancePO tCarMaintainPO){
        return tCarInsuranceService.upMaintain(tCarMaintainPO);
    }
}
